# 类
# class Washer:
#     height = 800
#     width = 450
#
#
# wa = Washer()
# wa2 = Washer()
# print(wa)
# print(wa2)

class Washer:
    height = 800

    def wash(self):
        print("我会洗衣服", self)


wa = Washer()
wa.wash()


class Person:
    name = "zhangsan"

    def introduce(self):
        print(f"{Person.name}的年龄：{self.age}")


pe = Person()
pe.age = 18  # 实例属性
pe.sex = '男'
print(pe.sex)
pe.introduce()


# 构造函数
class Test:
    def __init__(self):
        print("这个是__init__方法")


te = Test()


class Person:
    def __init__(self, name, age, height):
        self.name = name
        self.age = age
        self.height = height

    def play(self):
        print(f"{self.name}在玩游戏")

    def introduce(self):
        print(f"{self.name}的年龄是{self.age},身高{self.height}")

    def __del__(self):
        print(f"{self} 被销毁了")


pe = Person("zhansan", 20, 176)
pe.play()
print(pe.introduce())
pe2 = Person("lisi", 16, 168)
pe2.play()
print(pe2.introduce())
print("程序结束了...")
